package chapter08;

import java.util.Scanner;

public class Day7 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int sum = 0;
        int end = 0;
        System.out.println("请输入一个正整数：");
        for (int i = input.nextInt(); i >0 ; i/=10) {
            end = i %10;
            sum += end;
        }
        System.out.println("各位之和："+sum);
    }
}
